#!/usr/bin/python2

import requests

class Portal(object):
	'''
		Portal Login
	'''
	__index_url = r'http://172.20.1.1/portal/index_default.jsp'
	__login_url = r'http://172.20.1.1/portal/login.jsp'

	def __init__(self):
		self.__req = requests.Session()

	def login(self, u, p):
		self.__req.get(Portal.__index_url)
		
		payload = {
			'userName': u,
			'userPwd': p,
			'serviceType': 0
		}

		result = self.__req.post(Portal.__login_url, params=payload)

		return result

if __name__ == '__main__':
	login = Portal()
	data = login.login('201140701005', '123456')

	print(data.url)
